<?php

use yii\helpers\Html;
use yii\bootstrap\ActiveForm;
use kartik\select2\Select2;

/* @var $this yii\web\View */
/* @var $model ua_backend\models\User */
/* @var $form yii\widgets\ActiveForm */
//$listData=ArrayHelper::map('正常','禁用');
?>

<div class="row profile">
    <?php $form = ActiveForm::begin(['id' => 'form-profile']); ?>
    <div class="col-md-10">
        <div class="box box-primary">
            <div class="box-body">
                <?php
                if($model->isNewRecord)
                {
                    echo $form->field($model, 'username')->textInput(['maxlength' => true])->label('<span class="red">*</span> '.Yii::t('app', 'Username'));
                }else{
                    echo $form->field($model, 'username', ['inputOptions' => ['class'=>'form-control','disabled'=>'true']])->textInput(['maxlength' => true])->label('<span class="red">*</span> '.Yii::t('app', 'Username'));
                }
                ?>

                <?= $form->field($model, 'realname')->textInput(['maxlength' => true])->label('<span class="red">*</span> 真实姓名') ?>

                <?= $form->field($model, 'mobile')->textInput(['maxlength' => true])->label('<span class="red">*</span> 手机号') ?>

                <?= $form->field($model, 'email')->label('<span class="red">*</span> 邮箱') ?>

                <?php
                if(!isset($_GET['from'])){
                    echo $form->field($model, 'role')->widget(Select2::classname(), [
//                    'value' => [(isset($model->role) && $model->role==20)?20:21],
                        'data' => Yii::$app->params['role'],

                        'hideSearch' => true,
                        'pluginOptions'=>[
                            'placeholder' => Yii::t('app','Please select').' ...',
                            'width'      => '40%'
                        ]
                    ])->label("<span class=\"red\">*</span> 管理角色");
                }
                ?>

                <hr>

                <?= $form->field($model, 'password')->passwordInput(['value'=>$model->password_hash])->label('<span class="red">*</span> 登录密码') ?>

                <?= $form->field($model, 'rePassword')->passwordInput(['value'=>$model->password_hash])->label('<span class="red">*</span> 确认密码') ?>


            </div>

        </div>
        <div class="form-group" style="float: right">
            <?= Html::submitButton('<i class="fa fa-save"> </i> 保存', ['class' =>  'btn btn-primary']) ?>
        </div>
    </div>



    <?php ActiveForm::end(); ?>
</div>
